import request from './index'

export const getHotProducts = (params) => {
  return request({
    url: '/product/hotList',
    method: 'get',
    params: {
      type: params.type,
      categoryId: params.categoryId
    }
  }).catch(error => {
    console.error('获取热销商品失败:', error)
    throw error
  })
}

// 获取用户商品销售榜单
export const getUserHotList = (params) => {
  return request({
    url: '/product/userHotList',
    method: 'get',
    params: {
      type: params.type,
      categoryId: params.categoryId
    }
  }).catch(error => {
    console.error('获取用户商品销售榜单失败:', error)
    throw error
  })
}
